package com.edais.domain.gift;

import com.edais.domain.User;
import com.edais.domain.UserMessage;
import org.springframework.util.StringUtils;

public class PointGrade {
    private Long id;

    private String grade;

    private String intro;

    private Long minPoint;

    private Long maxPoint;

    private String name;

    private String upgradeMessageTitle;

    private String upgradeMessageContent;

    private String upgradeMessageImageUrl;

    private String upgradeAppPageUrl;

    private String upgradeWebUrl;

    private String upgradeWapUrl;

    private String upgradeButtonName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade == null ? null : grade.trim();
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro == null ? null : intro.trim();
    }

    public Long getMinPoint() {
        return minPoint;
    }

    public void setMinPoint(Long minPoint) {
        this.minPoint = minPoint;
    }

    public Long getMaxPoint() {
        return maxPoint;
    }

    public void setMaxPoint(Long maxPoint) {
        this.maxPoint = maxPoint;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getUpgradeMessageTitle() {
        return upgradeMessageTitle;
    }

    public void setUpgradeMessageTitle(String upgradeMessageTitle) {
        this.upgradeMessageTitle = upgradeMessageTitle == null ? null : upgradeMessageTitle.trim();
    }

    public String getUpgradeMessageContent() {
        return upgradeMessageContent;
    }

    public void setUpgradeMessageContent(String upgradeMessageContent) {
        this.upgradeMessageContent = upgradeMessageContent == null ? null : upgradeMessageContent.trim();
    }

    public String getUpgradeMessageImageUrl() {
        return upgradeMessageImageUrl;
    }

    public void setUpgradeMessageImageUrl(String upgradeMessageImageUrl) {
        this.upgradeMessageImageUrl = upgradeMessageImageUrl == null ? null : upgradeMessageImageUrl.trim();
    }

    public String getUpgradeAppPageUrl() {
        return upgradeAppPageUrl;
    }

    public void setUpgradeAppPageUrl(String upgradeAppPageUrl) {
        this.upgradeAppPageUrl = upgradeAppPageUrl == null ? null : upgradeAppPageUrl.trim();
    }

    public String getUpgradeWebUrl() {
        return upgradeWebUrl;
    }

    public void setUpgradeWebUrl(String upgradeWebUrl) {
        this.upgradeWebUrl = upgradeWebUrl == null ? null : upgradeWebUrl.trim();
    }

    public String getUpgradeWapUrl() {
        return upgradeWapUrl;
    }

    public void setUpgradeWapUrl(String upgradeWapUrl) {
        this.upgradeWapUrl = upgradeWapUrl == null ? null : upgradeWapUrl.trim();
    }

    public String getUpgradeButtonName() {
        return upgradeButtonName;
    }

    public void setUpgradeButtonName(String upgradeButtonName) {
        this.upgradeButtonName = upgradeButtonName == null ? null : upgradeButtonName.trim();
    }

    public Integer getIntGrade(){
        if(StringUtils.isEmpty(grade))
            return 0;
        return Integer.valueOf(grade);
    }

    public UserMessage toUserMessage(User user){
        UserMessage message = new UserMessage();
        message.setUserId(Long.valueOf(user.getId()));
        message.setStatus("0");//未读
        message.setMessageTitle(this.upgradeMessageTitle);
        message.setMessageContent(this.upgradeMessageContent);
        message.setMessageImageUrl(this.upgradeMessageImageUrl);
        message.setAppPageUrl(this.upgradeAppPageUrl);
        message.setWapUrl(this.upgradeWapUrl);
        message.setWebUrl(this.upgradeWebUrl);
        message.setButtonName(this.upgradeButtonName);
        return message;
    }
}